CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
PROJECT(test C CXX)

INCLUDE(${CMAKE_CURRENT_SOURCE_DIR}/cmake/utils.cmake)

SET(PROPERTY_FILE "${CMAKE_CURRENT_SOURCE_DIR}/build.properties")

#read properties files
LOAD_PROPERTY(properties ${PROPERTY_FILE})

MAP_GET(properties build_type build_type)
if(${build_type} STREQUAL "debug")
	SET(CMAKE_BUILD_TYPE Debug)
	MESSAGE(STATUS "Debug")
elseif(${build_type} STREQUAL "release")
	SET(CMAKE_BUILD_TYPE Release)
	MESSAGE(STATUS "Release")
else()
	SET(CMAKE_BUILD_TYPE "undefined")
endif()

MAP_GET(properties platform platform)
MAP_GET(properties architecture architecture)
MAP_GET(properties arch_option arch_option)
#set defines
if(${platform} STREQUAL "linux")
	ADD_DEFINITIONS(-DTEST_POSIX)
	ADD_DEFINITIONS(-DTEST_LINUX)
elseif(${platform} STREQUAL "win")
	ADD_DEFINITIONS(-DTEST_WIN)
	ADD_DEFINITIONS(-D_MBCS)
endif()

#src file
ADD_SUBDIRECTORY(src)
#target file
ADD_SUBDIRECTORY(example)

MESSAGE("CMAKE_BUILD_TYPE = ${CMAKE_BUILD_TYPE}")
